
UPDATE FLW_ID_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_ID_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_LIC_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_LIC_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_PL_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_PL_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE ACT_APP_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE ACT_APP_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_FO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_FO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_CO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

CREATE INDEX idx_rendition_contentid ON FLW_CO_RENDITION_ITEM(CONTENT_ITEM_ID_);

CREATE INDEX idx_metadata_contentid ON FLW_CO_METADATA(CONTENT_ITEM_ID_);

INSERT INTO FLW_CO_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('14', 'flowable', 'com/flowable/content/db/liquibase/flowable-content-db-changelog.xml', SYSTIMESTAMP, 14, '8:afbb9488d93f17414301a1ccef7ceb30', 'createIndex indexName=idx_rendition_contentid, tableName=FLW_CO_RENDITION_ITEM; createIndex indexName=idx_metadata_contentid, tableName=FLW_CO_METADATA', '', 'EXECUTED', NULL, NULL, '4.11.0', '8762467332');

UPDATE FLW_CO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_AD_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

ALTER TABLE FLW_ACTION_INSTANCE ADD ICON_ VARCHAR2(255);

INSERT INTO FLW_AD_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('17', 'flowable', 'com/flowable/action/db/liquibase/flowable-action-db-changelog.xml', SYSTIMESTAMP, 17, '8:0780dd3203da66d078aa6fcc6c2eabbd', 'addColumn tableName=FLW_ACTION_INSTANCE', '', 'EXECUTED', NULL, NULL, '4.11.0', '8762469614');

CREATE INDEX ACT_IDX_SCOPE_ID_TYPE ON FLW_ACTION_INSTANCE(SCOPE_ID_, SCOPE_TYPE_);

CREATE INDEX ACT_HI_IDX_SCOPE_ID_TYPE ON FLW_HI_ACTION_INSTANCE(SCOPE_ID_, SCOPE_TYPE_);

INSERT INTO FLW_AD_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('18', 'flowable', 'com/flowable/action/db/liquibase/flowable-action-db-changelog.xml', SYSTIMESTAMP, 18, '8:90f7eeb89565966bbd9517044d9e9a99', 'createIndex indexName=ACT_IDX_SCOPE_ID_TYPE, tableName=FLW_ACTION_INSTANCE; createIndex indexName=ACT_HI_IDX_SCOPE_ID_TYPE, tableName=FLW_HI_ACTION_INSTANCE', '', 'EXECUTED', NULL, NULL, '4.11.0', '8762469614');

UPDATE FLW_AD_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_AU_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_AU_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_DO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_DO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_PO_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_PO_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_SE_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_SE_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_TP_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

UPDATE FLW_TP_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;


UPDATE FLW_ENG_DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = '192.168.10.1 (192.168.10.1)', LOCKGRANTED = SYSTIMESTAMP WHERE ID = 1 AND LOCKED = 0;

CREATE TABLE FLW_ENGAGE_CONV_USR_ACCOUNT (CONVERSATION_ID_ VARCHAR2(64) NOT NULL, USER_ACCOUNT_ID_ VARCHAR2(64) NOT NULL, CONSTRAINT FK_CONV_USER_ACCOUNT_CONV FOREIGN KEY (CONVERSATION_ID_) REFERENCES FLW_ENGAGE_CONVERSATION(ID_) ON DELETE CASCADE, CONSTRAINT FK_CONV_USER_ACCOUNT_ACCOUNT FOREIGN KEY (USER_ACCOUNT_ID_) REFERENCES FLW_ID_USER_ACCOUNT(ID_) ON DELETE CASCADE);

CREATE TABLE FLW_ENGAGE_MSG_REF_MAPPING (MESSAGE_ID_ VARCHAR2(64) NOT NULL, REFERENCE_ID_ VARCHAR2(64), REFERENCE_TYPE_ VARCHAR2(64), CONSTRAINT FK_MSG_REF_MAPPING_MESSAGE_ID FOREIGN KEY (MESSAGE_ID_) REFERENCES FLW_ENGAGE_MESSAGE(ID_) ON DELETE CASCADE);

INSERT INTO FLW_ENGAGE_MSG_REF_MAPPING(MESSAGE_ID_, REFERENCE_ID_, REFERENCE_TYPE_)
            SELECT
                MSG.ID_,
                MSG.REFERENCE_ID_,
                MSG.REFERENCE_TYPE_
            FROM FLW_ENGAGE_MESSAGE MSG
            WHERE MSG.REFERENCE_ID_ is not null;

INSERT INTO FLW_ENGAGE_CONV_USR_ACCOUNT(CONVERSATION_ID_, USER_ACCOUNT_ID_)
            SELECT
                CONV.ID_,
                CONV.USER_ACCOUNT_ID_
            FROM FLW_ENGAGE_CONVERSATION CONV
            WHERE CONV.USER_ACCOUNT_ID_ is not null;

CREATE INDEX FLW_IDX_MSG_REF_MAPPING_REF ON FLW_ENGAGE_MSG_REF_MAPPING(REFERENCE_TYPE_, REFERENCE_ID_);

DROP INDEX FLW_IDX_MSG_REF_ID_REF_TYPE;

ALTER TABLE FLW_ENGAGE_MESSAGE DROP COLUMN REFERENCE_ID_;

ALTER TABLE FLW_ENGAGE_MESSAGE DROP COLUMN REFERENCE_TYPE_;

ALTER TABLE FLW_ENGAGE_TEMP_MESSAGE DROP COLUMN REFERENCE_ID_;

ALTER TABLE FLW_ENGAGE_TEMP_MESSAGE DROP COLUMN REFERENCE_TYPE_;

INSERT INTO FLW_ENG_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('22', 'flowable', 'com/flowable/engage/db/liquibase/flowable-engage-db-changelog.xml', SYSTIMESTAMP, 22, '8:896b049a360adb74481f00c40663ff15', 'createTable tableName=FLW_ENGAGE_CONV_USR_ACCOUNT; createTable tableName=FLW_ENGAGE_MSG_REF_MAPPING; sql; sql; createIndex indexName=FLW_IDX_MSG_REF_MAPPING_REF, tableName=FLW_ENGAGE_MSG_REF_MAPPING; dropIndex indexName=FLW_IDX_MSG_REF_ID_REF_TYPE...', '', 'EXECUTED', NULL, NULL, '4.11.0', '8762484404');

ALTER TABLE FLW_ENGAGE_CONVERSATION DROP CONSTRAINT FK_CONV_USER_ACCOUNT;

DROP INDEX FLW_IDX_CONV_USER_ACCOUNT;

ALTER TABLE FLW_ENGAGE_CONVERSATION DROP COLUMN USER_ACCOUNT_ID_;

CREATE INDEX FLW_IDX_CONV_USR_ACC_CONV ON FLW_ENGAGE_CONV_USR_ACCOUNT(CONVERSATION_ID_);

CREATE INDEX FLW_IDX_CONV_USR_ACC_ACCOUNT ON FLW_ENGAGE_CONV_USR_ACCOUNT(USER_ACCOUNT_ID_);

CREATE INDEX FLW_IDX_MSG_REF_MAPPING_MSG ON FLW_ENGAGE_MSG_REF_MAPPING(MESSAGE_ID_);

INSERT INTO FLW_ENG_DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('23', 'flowable', 'com/flowable/engage/db/liquibase/flowable-engage-db-changelog.xml', SYSTIMESTAMP, 23, '8:c65cba0109fbcb2866e15079136ee361', 'dropForeignKeyConstraint baseTableName=FLW_ENGAGE_CONVERSATION, constraintName=FK_CONV_USER_ACCOUNT; dropIndex indexName=FLW_IDX_CONV_USER_ACCOUNT, tableName=FLW_ENGAGE_CONVERSATION; dropColumn columnName=USER_ACCOUNT_ID_, tableName=FLW_ENGAGE_CON...', '', 'EXECUTED', NULL, NULL, '4.11.0', '8762484404');

UPDATE FLW_ENG_DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1;

